buildconfigs/src.git-clone: use git clone, avoid git remote
authorKeir Fraser <keir.fraser@citrix.com>
Thu, 18 Jun 2009 14:32:48 +0000 (15:32 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Thu, 18 Jun 2009 14:32:48 +0000 (15:32 +0100)
git 1.4.x (which is on even some moderately recent systems) doesn't
have the `git remote' command.  This is what caused the most recent
patchman build failure.

The machinery in buildconfigs/src.git-clone was rather more
complicated than needed, too.  In this patch I replace this with a
similar set of runes to those used for ioemu-remote (almost identical
except that the QEMU_TAG feature is not supported in this instance).

I have done a successful test build with this change.

Cc: Ian Campbell <Ian.Campbell@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
buildconfigs/mk.linux-2.6-pvops
buildconfigs/mk.linux-2.6-tip-latest
buildconfigs/src.git-clone

index 56e606f1799374c649ff3fa666d7959701364e05..5f0f555a2136317c7281fa4161a2db1cb05293d7 100644 (file)
@@ -6,7 +6,6 @@ IMAGE_TARGET ?= bzImage
 XEN_LINUX_CONFIG_UPDATE := buildconfigs/enable-xen-config
 
 XEN_LINUX_GIT_URL ?= git://git.kernel.org/pub/scm/linux/kernel/git/jeremy/xen.git
-XEN_LINUX_GIT_REMOTENAME ?= xen
 XEN_LINUX_GIT_REMOTEBRANCH ?= xen-tip/master
 
 EXTRAVERSION ?=
index 78a9ecb7468da0ad0ebab46f728ebe5b9579e603..e5dcd3bfba617ff2ebfacb0dc5ea5ebed4611b66 100644 (file)
@@ -6,7 +6,6 @@ IMAGE_TARGET ?= bzImage vmlinux
 XEN_LINUX_CONFIG_UPDATE := buildconfigs/enable-xen-config
 
 XEN_LINUX_GIT_URL ?= git://git.kernel.org/pub/scm/linux/kernel/git/x86/linux-2.6-tip.git
-XEN_LINUX_GIT_REMOTENAME ?= x86
 XEN_LINUX_GIT_REMOTEBRANCH ?= auto-latest
 
 EXTRAVERSION ?=
index 722d45a8653b783cb76d20cabe78e165d7b38238..b8712026890afbf238dd78d7d8975a13ba4a35c0 100644 (file)
@@ -8,9 +8,6 @@ ifeq ($(XEN_LINUX_GIT_URL),)
 .ERROR: XEN_LINUX_GIT_URL not specified
 endif
 
-# The name to use for the remote repository
-XEN_LINUX_GIT_REMOTENAME ?= origin
-
 # The branch in the remote repository
 ifeq ($(XEN_LINUX_GIT_REMOTEBRANCH),)
 .ERROR: XEN_LINUX_GIT_REMOTEBRANCH not specified
@@ -22,39 +19,13 @@ XEN_LINUX_GIT_LOCALBRANCH ?= master
 XEN_LINUX_GITREV  ?= 
 
 $(LINUX_SRCDIR)/.valid-src: $(__XEN_LINUX_UPDATE)
-       @set -e ; if [ -d $(LINUX_SRCDIR) ] && [ ! -d $(GIT_DIR) ] ; then \
-           echo "$(LINUX_SRCDIR) exists but is not a git repository." 1>&2 ; \
-           false ; \
-       fi
-
-       @set -e ; if [ ! -e $(LINUX_SRCDIR)/.git ] ; then \
-           mkdir $(LINUX_SRCDIR) ; \
-           cd $(LINUX_SRCDIR) ; \
-           $(GIT) init-db ; \
+       set -ex; \
+       if ! [ -d $(LINUX_SRCDIR) ]; then \
+               rm -rf $(LINUX_SRCDIR) $(LINUX_SRCDIR).tmp; \
+               mkdir $(LINUX_SRCDIR).tmp; rmdir $(LINUX_SRCDIR).tmp; \
+               $(GIT) clone $(XEN_LINUX_GIT_URL) $(LINUX_SRCDIR).tmp; \
+               cd $(LINUX_SRCDIR).tmp; \
+               $(GIT) checkout $(XEN_LINUX_GIT_REMOTEBRANCH); \
+               cd ..; mv $(LINUX_SRCDIR).tmp $(LINUX_SRCDIR); \
        fi
-
-       @set -e ; cd $(LINUX_SRCDIR) ; \
-       if ! $(GIT) remote | grep -q $(XEN_LINUX_GIT_REMOTENAME) ; then \
-           echo "Adding remote git repository \`$(XEN_LINUX_GIT_URL)' as \`$(XEN_LINUX_GIT_REMOTENAME)'" ; \
-           $(GIT) remote add $(XEN_LINUX_GIT_REMOTENAME) $(XEN_LINUX_GIT_URL) ; \
-       fi
-
-       @echo "Updating remote \`$(XEN_LINUX_GIT_REMOTENAME)'"
-       @cd $(LINUX_SRCDIR) && $(GIT) fetch $(XEN_LINUX_GIT_REMOTENAME)
-
-       @set -e ; cd $(LINUX_SRCDIR) ; \
-       if ! $(GIT) branch -l | grep -q $(XEN_LINUX_GIT_LOCALBRANCH) ; then \
-           $(GIT) branch --track $(XEN_LINUX_GIT_LOCALBRANCH) \
-               $(XEN_LINUX_GIT_REMOTENAME)/$(XEN_LINUX_GIT_REMOTEBRANCH) ; \
-           $(GIT) checkout ; \
-       fi
-
-       @ set -e ; cd $(LINUX_SRCDIR) ; \
-       if [ -n "$(XEN_LINUX_GITREV)" ] ; then \
-           echo "Updating $(LINUX_SRCDIR) to revision \'$(XEN_LINUX_GITREV)'." ; \
-           $(GIT) reset --hard $(XEN_LINUX_GITREV) ; \
-       else \
-           $(GIT) reset --hard $(XEN_LINUX_GIT_REMOTENAME)/$(XEN_LINUX_GIT_REMOTEBRANCH) ; \
-       fi
-
        touch $@